﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using Oxite.ViewModels;
using ECube.Org.Services;
using ECube.Org.Models;
namespace ECube.Org.Controllers
{
    public class OrganizationController : Controller
    {
        private readonly IOrganizationService OrgService; 
        public OrganizationController(IOrganizationService orgService)
        {
            OrgService = orgService;
        }
        public OxiteViewModelItem<IEnumerable<Organization>> Manage(string id)
        {
            return new OxiteViewModelItem<IEnumerable<Organization>>(OrgService.GetOrganizations());
        }
        public ActionResult Item(int id)
        {
            Organization org = OrgService.GetOrganization(id);
            return this.PartialView(org);
        }

        [HttpPost]
        public ActionResult Item(int id, bool isJson)
        {

            if (isJson)
            {
                return Json("");
            }
            return View();
        }
    }
}
